import React, { Component } from "react";
import {
  HashRouter as Router,
  Route,
  Switch,
  Redirect,
} from "react-router-dom";
import Home from "../components/home/home"
import Catetry from "../components/catetry/catetry"
import Cart from "../components/cart/cart"
import My from "../components/my/my"
import Search from "../components/search/search"
import Index from "../components/index"
import Goods from "../components/goods/goods"
import GoodList from "../components/goodList/goodList"
export default class RouterIndex extends Component {
  render() {
    return (
      <Router>
        <Switch>
          <Route path="/home" exact render={()=><Index><Home></Home></Index>}></Route>
          <Route path="/catetry" exact render={()=><Index><Catetry></Catetry></Index>}></Route>
          <Route path="/cart" exact render={()=><Index><Cart></Cart></Index>}></Route>
          <Route path="/my" exact render={()=><Index><My></My></Index>}></Route>
          <Route path="/search" exact render={()=><Search></Search>}></Route>
          <Route path="/goods/:id" exact  render={(props)=><Goods  {...props}></Goods>}></Route>
          <Route path="/goodList/:name" exact render={(props)=><GoodList  {...props}></GoodList>}></Route>
          <Redirect to="/home"  from="/" exact></Redirect>
        </Switch>
      </Router>
    );
  }
}
